header to metadata: add base64 encode and protobuf value type#7796
header to metadata: add base64 encode and protobuf value type#7796lizan merged 7 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Yangmin Zhu <ymzhu@google.com>
|
For the second point, just a quick question, do we prefer to add a new |
|
Can something be done to avoid serializing the metadata on every request, and do it only once during filter construction? That's the critical part in the existing istio implementation. |
|
cc @mandarjog |
| // `Base64Url <https://tools.ietf.org/html/rfc4648#section-5>`_ encoded string of | ||
| // serialized `protobuf.Value | ||
| // <https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto#L62>`_ | ||
| BASE64URL_SERIALIZED = 2; |
There was a problem hiding this comment.
This is counter intuitive from API stand point without reading the comment above, from reading the implementation, I'd say make this VALUE or PROTOBUF_VALUE, and have another enum for the encoding to express it, since which base64 or not is orthogonal to value type here, WDYT?
There was a problem hiding this comment.
That looks a cleaner API though I imagine the base64 option is likely to be always used only with PROTOBUF_VALUE?
I'm fine with the suggestion, @rgs1 WDYT?
There was a problem hiding this comment.
It is possible for someone to use STRING with BASE64 with some non header safe character sets (UTF-8), and when you add more binary types here it will help anyway.
There was a problem hiding this comment.
yeah i like Lizan's suggestion (PROTOBUF_VALUE).
|
@kyessenov Hmm, not sure I understand your question. Could you clarify a little bit? Thanks. I thought the header value is only known on request so how can we do the serialization only during filter construction? One thing I can think of right now is to use a cache to avoid the serialization on every request. Is this what you're suggesting? |
|
@yangminzhu The filter I referenced sends node metadata, which is always the same across all requests. For example, pod labels. |
|
@kyessenov I see, Are you referring to the client side sending the metadata via header? I think that is not covered in this PR and will be solved with the new This PR is about the server side decoding the header, Is there anything else we should take care of here? thanks! |
|
@yangminzhu @kyessenov take a look on #2394 while it is not completely standardized though it is partially implemented. cc @soya3129 for current status. |
|
IIUC it allows per connection metadata exchange as well as per stream metadata exchange. |
|
@lizan Yes, we're are aware of H2 metadata. It's very cool, but unfortunately the world has not even moved to H2 yet, so it'll cause issues with inter-operability with other proxies (or even gRPC). |
source/extensions/filters/http/header_to_metadata/header_to_metadata_filter.cc
Outdated
Show resolved
Hide resolved
source/extensions/filters/http/header_to_metadata/header_to_metadata_filter.cc
Outdated
Show resolved
Hide resolved
|
@yangminzhu This is fine for extracting a request header to metadata. I'm still not entirely sure how this works for extracting a response headers from an upstream host, to be usable as a replacement for the istio filter. |
The h-t-m filter works for both request/response headers, fwiw. Also, do we need a separate |
|
@rgs1 Gotcha, I didn't see response rules at first. |
Signed-off-by: Yangmin Zhu <ymzhu@google.com>
|
@lizan @rgs1 @kyessenov PTAL, the coverage seems failing for some network error, thank you. |
zuercher
left a comment
There was a problem hiding this comment.
This seems very useful. Thanks for looking into it. To start with, I have a question about the API, once we get that nailed down I'll look at the rest more closely.
api/envoy/config/filter/http/header_to_metadata/v2/header_to_metadata.proto
Outdated
Show resolved
Hide resolved
Signed-off-by: Yangmin Zhu <ymzhu@google.com>
source/extensions/filters/http/header_to_metadata/header_to_metadata_filter.cc
Outdated
Show resolved
Hide resolved
htuch
left a comment
There was a problem hiding this comment.
@envoyproxy/api-shepherds API LGTM
Signed-off-by: Yangmin Zhu <ymzhu@google.com>
source/extensions/filters/http/header_to_metadata/header_to_metadata_filter.cc
Outdated
Show resolved
Hide resolved
test/extensions/filters/http/header_to_metadata/header_to_metadata_filter_test.cc
Outdated
Show resolved
Hide resolved
Signed-off-by: Yangmin Zhu <ymzhu@google.com>
|
@htuch Would you mind to approve for the API again? I pushed a new commit to resolve some other comments, no new changes in API. Thank you. |
|
No API changes since last API review, just merged. |
Signed-off-by: Yangmin Zhu ymzhu@google.com
For the first point in #7771 for converting arbitrary protobuf value from header to metadata.
cc @rgs1 @kyessenov
For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md
Description:
Risk Level: Low
Testing: Unit tests
Docs Changes: Updated version_history.rst
Release Notes: Updated version_history.rst
[Optional Fixes #Issue]
[Optional Deprecated:]